package com.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.entity.FieldsEntity;
import com.entity.TimetrackingEntity;
@Repository
public class TimetrackingDaoImpl extends GenericDaoImpl<TimetrackingEntity>
		implements TimetrackingDao {

	public TimetrackingEntity getTimetrackingById(int id) {
		return getById(TimetrackingEntity.class, id);
	}

	public List<TimetrackingEntity> getAllTimetracking() {
		return getAll(TimetrackingEntity.class);
	}
	
	public int getMaxTimetracking(){
		String hql = "Select max(idTimetracking) From TimetrackingEntity";
		Query query = sessionFactory.getCurrentSession().createQuery(hql);
		return (Integer) query.uniqueResult();
	}

}
